﻿using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Windows;
namespace WPFExcelReport
{
    public partial class THR20YY
    { 
        public THR20YY()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VHRSTAMM();
            this.DataContext = MV;
            InitializeComponent();
        }
      
        //根据班次，织机，找到挡车工列表，选择挡车工
        public override void OnEXAUFChg(string vlaue)
        {
            dwData = TBMain.NewRow();
            string sql = "";
            SResult = TMV.QHRRTWVER(sql);
            MergeData(SResult, true);
            base.OnEXAUFChg(vlaue);
        }
        public override void CHKWVER()
        {
            TBMain.Clear();
            if (MachineName.Trim() == "")
                return;
            if (SHIFT.Trim() == "")
                return;
            string sdate = Helpers.Helper.GetDateAddDays(TMV.date, -1);
            string sql = " and MC.MachineName = '" + MachineName + "'  and CL.ClassTypeID =" + SHIFT + " and ClassStartTime>='" + sdate + "'";
            
            if (app.IsSQLDEMO)
            {
                SResult = TMV.QHRRTDEMO(sql);
            }
            else
            {
                SResult = TMV.QHRRTWVER(sql);
            }
            MergeData(SResult, true, true);
        } 
    }
    
}
